#version 460
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require


#include "../../../../core/shader_binding_ID.h"
#include "../../../../core/shader_std.h"
#include "../../../../core/shader_built_in_functions.h"
#include "../../../../core/shader_curve.h" 

layout(lines) in;
layout(line_strip, max_vertices=34) out;


layout(location = 0) in vec4 vColor[];
layout(location=1) in S_CurvePoint3D v_CPoint[];
layout(location=5) in vec3 vCameraPos[];
layout(location=6) in uint vType[];
layout(location=7) in mat4 vMatrix[];

layout(location = 0) out vec4 outColor;

out gl_PerVertex {
	vec4	gl_Position;
};



void main(void){
	
	for(int i=0; i<32; ++i){
		float t = 0.03125f * i;
		vec3 p1 = f_glsl_cal_CubicCurve(v_CPoint[0].value, v_CPoint[0].R_point, v_CPoint[1].value, v_CPoint[1].L_point, t);
		
		outColor = vColor[0];
		gl_Position = vMatrix[0] * vec4(p1, 1);
		EmitVertex();
	}

	vec3 p2 = f_glsl_cal_CubicCurve(v_CPoint[0].value, v_CPoint[0].R_point, v_CPoint[1].value, v_CPoint[1].L_point, 1);
	outColor = vColor[1];
	gl_Position = vMatrix[0] * vec4(p2, 1);
	EmitVertex();
	//gl_Position = vMatrix[0] * vec4(vec3(1,1,1), 1);
	//EmitVertex();
	//gl_Position = vMatrix[0] * vec4(vec3(2,2,2), 1);
	//EmitVertex();
	EndPrimitive();
}



